<!DOCTYPE html>
<html>
<head>
<title>Weiran ECMAScript Applications Framework</title>
<link rel=stylesheet type=text/css href=./style.css>
</head>

<body>

<div class=leftbar>
    <h1>Weiran</h1>
    <p>ECMAScript<br />Applications Framework</p>
    <p>Version: 1.2</p>
    <ul>
	<li><a href=Weiran.html>Weiran</a></li>
	<li><a href=Weiran.Array.html>Weiran.Array</a></li>
	<li><a href=Weiran.Buffer.html>Weiran.Buffer</a></li>
	<li><a href=Weiran.Class.html>Weiran.Class</a></li>
	<li><a href=Weiran.Date.html>Weiran.Date</a></li>
	<li><a href=Weiran.DB.html>Weiran.DB</a></li>
	<li><a href=Weiran.Event.html>Weiran.Event</a></li>
	<li><a href=Weiran.Events.html>Weiran.Events</a></li>
	<li><a href=Weiran.Function.html>Weiran.Function</a></li>
	<li><a href=Weiran.JSON.html>Weiran.JSON</a></li>
	<li><a href=Weiran.Lang.html>Weiran.Lang</a></li>
	<li><a href=Weiran.Number.html>Weiran.Number</a></li>
	<li>Weiran.String<ul>
	    <li><a href=#Weiran.String.startsWith>Weiran.String.startsWith</a></li>
	    <li><a href=#Weiran.String.contains>Weiran.String.contains</a></li>
	    <li><a href=#Weiran.String.trim>Weiran.String.trim</a></li>
	    <li><a href=#Weiran.String.camelize>Weiran.String.camelize</a></li>
	    <li><a href=#Weiran.String.format>Weiran.String.format</a></li>
	    <li><a href=#Weiran.String.isNumeric>Weiran.String.isNumeric</a></li>
	    <li><a href=#Weiran.String.numericIf>Weiran.String.numericIf</a></li>
	    <li><a href=#Weiran.String.isEmail>Weiran.String.isEmail</a></li>
	    <li><a href=#Weiran.String.isURL>Weiran.String.isURL</a></li>
	</ul></li>
	<li><a href=Weiran.GRUB.html>GRUB Mechanism</a></li>
    </ul>
    <p>
        Copyright &copy; All<span>i</span>dylls<br />
        2011 - 2012
    </p>
</div>

<div class=content>

<div class=reftitle>Weiran.String</div>
<p>Sub namespace contains convenience functions for string manipulation.</p>

<a name=Weiran.String.startsWith></a>
<h3><code>Weiran.String.startsWith(str, sub)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>str</span> - <code>string</code><br />
    <span class=parameters>sub</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Returns whether the first string starts with the second.</p>

<a name=Weiran.String.contains></a>
<h3><code>Weiran.String.contains(str, sub)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>str</span> - <code>string</code><br />
    <span class=parameters>sub</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Returns whether the first string contains the second.</p>

<a name=Weiran.String.trim></a>
<h3><code>Weiran.String.trim(str)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>str</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>string</code></p>
<p>Returns a trimmed version of the string with all leading and trailing spaces removed.</p>

<a name=Weiran.String.camelize></a>
<h3><code>Weiran.String.camelize(str)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>str</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>string</code></p>
<p>Returns the camelized string. Camel-case a hyphenated string. 
        Ex. "chicken-head" becomes "chickenHead", and "-chicken-head" becomes "ChickenHead".</p>

<a name=Weiran.String.format></a>
<h3><code>Weiran.String.format(template, context, args)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>template</span> - <code>string</code><br />
    <span class=parameters>context</span> - <code>object</code>, optional object<br />
    <span class=parameters>args</span> - <code>array</code>, optional arguments
</p>
<p><b>Returns: </b><code>string</code></p>
<p>Given a string with tokens in the form <code>${token}</code>, 
	return a string with tokens replaced with properties from the given context object.
    Represent a literal <code>${</code> by doubling it, e.g. <code>${${</code>.</p>
<p>A template has the form <code>literal ${token}</code> where the token will be replaced by the value of
	<code>context["token"]</code>.
    The context parameter is an optional object with properties corresponding to the tokens in the format string.
    If no context is sent, the <code>window</code> object will be used.</p>
<p>The args is an optional arguments to pass to any functions found in the context.
    If a context property is a function,
    the token will be replaced by the return from the function called with these arguments.</p>

<a name=Weiran.String.isNumeric></a>
<h3><code>Weiran.String.isNumeric(str)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>str</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Returns whether a string contains only a number. </p>
<p>Examples:</p>
<p>&nbsp;&nbsp;<code>Weiran.String.isNumeric("6.02e23") // true</code><br />
   &nbsp;&nbsp;<code>Weiran.String.isNumeric("12 dozen") // false</code><br />
   &nbsp;&nbsp;<code>Weiran.String.isNumeric("4") // true</code><br />
   &nbsp;&nbsp;<code>Weiran.String.isNumeric(" 4 ") // false</code></p>

<a name=Weiran.String.numericIf></a>
<h3><code>Weiran.String.numericIf(value)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>value</span> - <code>number | string</code>
</p>
<p><b>Returns: </b><code>number | string</code></p>
<p>Returns a Number if the passed value is a number, a String otherwise.</p>

<a name=Weiran.String.isEmail></a>
<h3><code>Weiran.String.isEmail(str)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>str</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Determine whether a string is an email address.</p>

<a name=Weiran.String.isURL></a>
<h3><code>Weiran.String.isURL(str)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>str</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Determine whether a string is an URL.</p>

</div>

</body>
</html>
